package com.helpyoutimely.home;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageButton;
import android.widget.ListView;

import com.helpyoutimely.R;
import com.helpyoutimely.entity.Order;
import com.helpyoutimely.order.adapter.OrderListAdapter;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2016/4/14.
 */
public class OrderListActivity extends Activity implements View.OnClickListener{

    ImageButton backBtn;
    ListView orderListView;
    OrderListAdapter adapter;
    List<Order> orderList;
    private Order mOrder;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_orderlist);
        initData();

        backBtn = (ImageButton) findViewById(R.id.orderback);
        orderListView = (ListView) findViewById(R.id.orderlist);
        adapter = new OrderListAdapter(this,orderList);
        orderListView.setAdapter(adapter);


        backBtn.setOnClickListener(this);



    }

    @Override
    public void onClick(View view){
        switch (view.getId()){
            case R.id.orderback:
                finish();
        }
    }
    private void initData(){
        orderList = new ArrayList<>();


        Order order1 = new Order();
        order1.setOrderStatus("已完成");
        order1.setOrderDate(new Date());
        order1.setOrderDetail("孩子不讲卫生怎么办？");
        order1.setOrderImgId(R.drawable.zard1);
        order1.setOrderName("李老师");
        order1.setOrderPrice("￥35");
        order1.setOrderTimer("15分钟，小费5元");

        Order order2 = new Order();
        order2.setOrderStatus("已完成");
        order2.setOrderDate(new Date());
        order2.setOrderDetail("孩子突然不想上学怎么办？");
        order2.setOrderImgId(R.drawable.zard2);
        order2.setOrderName("黄老师");
        order2.setOrderPrice("￥24");
        order2.setOrderTimer("12分钟，小费0元");

        orderList.add(order1);
        orderList.add(order2);
    }
}
